﻿<?php
	include_once('../sys/sys.php');
	include_once('./gfun.php');
	include_once('./funcs.php');
	header('Content-Type: text/html; charset=utf-8');
	
	$action = $_GET['action'];
	//$accc = array();
	
	if ($action == 'pic'){
		//获取所有在下载中没连接的应用ID
		$piclists = '';
		$row = $DB->build_query(array(
				'select' 	=> 'imgorgurl',
				'from'		=> 'gfunpics',
		));
		$qid = $DB->exec_query();
		while ($row = $DB->fetch_row($qid)) {
			$piclists .= $row['imgorgurl'] . "\r\n"; 
		}
		file_put_contents($web_local_pic . "1.lst", $piclists);
		echo "文件已生成至:  " . $web_local_pic . "1.lst";
		exit;
	}
	else if ($action == 'apk'){
		$apklist = '';
		$row = $DB->build_query(array(
				'select' 	=> 'downorgurl',
				'from'		=> 'gfunappds',
		));
		$qid = $DB->exec_query();
		while ($row = $DB->fetch_row($qid)) {
			$piclists .= $row['downorgurl'] . "\r\n";
		}
		file_put_contents($web_local_apk . "1.lst", $piclists);
		echo "文件已生成至:  " . $web_local_apk . "1.lst";
		exit;
		
	}
	header('HTTP/1.1 404 Not Found');
	header("status: 404 Not Found");
	//print_r($accc);
	exit;
	
	
	
	
?>